#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 15;
const int M = 105;
const int MOD = 998244353;

int n, m;
int dp[2][N];
char s[N];
int f[M][1 << (N + 1)];
int ans[N];
void decode(int s, int d[N]) {
  rep(i, 0, n) d[i] = (s >> i) & 1;
  rep(i, 1, n) d[i] += d[i - 1];
}
int encode(int d[N]) {
  per(i, n, 1) d[i] -= d[i - 1];
  int res = 0;
  rep(i, 0, n) if (d[i]) res |= 1 << i;
  return res;
}
void nxt(char c, int pre[N], int now[N]) {
  now[0] = 0;
  rep(i, 1, n) {
    // f[i][j] = f[i - 1][j], f[i][j - 1], f[i - 1][j - 1] + 1
    now[i] = 0;
    if (c == s[i])
      now[i] = max(now[i], pre[i - 1] + 1);
    else {
      now[i] = max(now[i], now[i - 1]);
      now[i] = max(now[i], pre[i]);
    }
  }
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> s[i];
  f[0][0] = 1;
  rep(i, 1, m) {
    rep(s, 0, (1 << (n + 1)) - 1) {
      if (!f[i - 1][s]) continue;
      decode(s, dp[0]);
      rep(c, 'a', 'z') {
        nxt(c, dp[0], dp[1]);
        int t = encode(dp[1]);
        f[i][t] = (f[i][t] + f[i - 1][s]) % MOD;
      }
    }
  }
  rep(s, 0, (1 << (n + 1)) - 1) {
    if (!f[m][s]) continue;
    decode(s, dp[0]);
    int k = dp[0][n];
    ans[k] = (ans[k] + f[m][s]) % MOD;
  }
  rep(i, 0, n) cout << ans[i] << ' ';
  return 0;
}